/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.collectio.pare;

//import com.netflix.util.Pair;

import org.apache.commons.lang3.tuple.MutablePair;
import org.apache.commons.lang3.tuple.Pair;

public class PaireTest {
    public static void main(String[] args) throws Exception {
        Pair<Integer, Integer> pair = Pair.of(1, 10); //同ImmutablePair.of(1, 10)
        Integer left = pair.getLeft();
        Integer right = pair.getRight();
        System.out.println(left); //1
        System.out.println(right); //10
        //pair.setValue(30); //报错：java.lang.UnsupportedOperationException

        System.out.println("---------------------------------------------");
        pair = MutablePair.of(1, 10);
        left = pair.getLeft();
        right = pair.getRight();
        ((MutablePair<Integer, Integer>) pair).setLeft(100);
        ((MutablePair<Integer, Integer>) pair).setRight(200);
        System.out.println(left); //100
        System.out.println(right); //200
        pair.setValue(200); //备注setValue同setRight方法

    }

}
